<template>
  <div>
    <div>
      <el-form :inline="true" :model="page" class="demo-form-inline">
        <el-form-item label="提现申请日期">
          <el-date-picker
            v-model="page.applyDate1"
            type="date"
            placeholder="选择日期">
          </el-date-picker>-
          <el-date-picker
            v-model="page.applyDate2"
            type="date"
            placeholder="选择日期">-
          </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="getlist()">查询</el-button>
        </el-form-item>
      </el-form>
    </div>
    <template>
      <el-table
        ref="multipleTable"
        :data="tableData"
        tooltip-effect="dark"
        style="width: 100%"
        @selection-change="handleSelectionChange">
        <el-table-column
          type="selection"
          width="55">
        </el-table-column>
        <el-table-column
          prop="businessName"
          label="商户名称"
          width="120">
        </el-table-column>
        <el-table-column
          prop="applyDate"
          label="申请日期"
          width="120">
        </el-table-column>
        <el-table-column
          prop="applyAmount"
          label="提现金额"
          show-overflow-tooltip>
        </el-table-column>
        <el-table-column
          prop="checkState"
          label="是否审核"
          show-overflow-tooltip>
          <template slot-scope="checkState">
            <span v-if="checkState.row.checkState==1">审核通过</span>
            <span v-if="checkState.row.checkState==2">待审核</span>
            <span v-if="checkState.row.checkState==3">审核不通过</span>
          </template>
        </el-table-column>
      </el-table>
      <div style="margin-top: 20px">
        <el-button @click="toggleSelection([tableData[1], tableData[2]])">切换第二、第三行的选中状态</el-button>
        <el-button @click="toggleSelection()">取消选择</el-button>
      </div>
      <el-button type="warning" @click="shen()">审核通过</el-button>
    </template>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="page.pageNo"
      :limit.sync="page.pageSize"
      @pagination="getlist"
    />
  </div>
</template>

<script>
  import {tilist,shenhe} from "@/api/system/jinrong";
  export default {
    name: "index",
    data() {
      return {
        tableData: [],
        multipleSelection: [],
        formInline:{},
        page:{
          pageNo:1,
          pageSize:5,
        },
        total:0,
        multipleSelection:[],
      }
    },
    methods:{
      toggleSelection(rows) {
        if (rows) {
          rows.forEach(row => {
            this.$refs.multipleTable.toggleRowSelection(row);
          });
        } else {
          this.$refs.multipleTable.clearSelection();
        }
      },
      handleSelectionChange(val) {
        this.multipleSelection = val;
        alert(this.multipleSelection)
      },

      getlist(){
        tilist(this.page).then(res=>{
          console.log(res);
          this.total=res.data.total;
          this.tableData = res.data.list;
        })
      },
      shen(){
        shenhe(this.multipleSelection).then(res=>{
          this.$message(res.msg);
        })
      }
    },
    created() {
      this.getlist();
    }
  }
</script>

<style scoped>

</style>
